<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>

<body>
    <div id="app">
        <cpn><button>按钮</button></cpn>
        <cpn></cpn>
        <cpn>
            <template slot-scope='slot'>
                <!-- <span v-for="item in slot.data">{{item}} - </span> -->
                <span>{{slot.data.join(' - ')}}</span>
            </template>
        </cpn>
    </div>

    <template id="cpn">
        <div>
            <h3>插槽</h3>
            <p>我是插槽！</p>
            <slot :data="Planguages">
                <ul>
                    <ol v-for="item in Planguages">{{item}}</ol>
                </ul>
            </slot>
            <slot><button>默认按钮</button></slot>
        </div>
    </template>

    <script>
        //创建Vue实例,得到 ViewModel
        var vm = new Vue({
            el: '#app',
            data: {},
            components: {
                cpn: {
                    template: '#cpn',
                    data() {
                        return {
                            Planguages: ['Java', 'JavaScript', 'C', 'C#', 'Python', 'Go']
                        }
                    }
                }
            }
        });
    </script>
</body>

</html>